/*
* Copyright (c) 2007 by Kirill Kolodyazhniy.
* See the file "license.terms" for information on usage and redistribution.
*/

#ifndef M_SLOTHELPER_H
#define M_SLOTHELPER_H

namespace Engine
{
	/** 
	*   Class with helper structures for slot.
	*/
	class SlotHelper
	{
	public:
		/** 
		*   Empty type for identify unusable template parameters.
		*/
		struct unusable{};

		/** 
		*   Structure to determine is template parameter is specified.
		*/
		template <class T>
		struct is_usable
		{ enum { value = 1 }; };

		/** 
		*   Structure to select between types in depending on condition.
		*/
		template<int condition, class A, class B>
		struct select_switch
		{
			typedef unusable value;
		};
	};

	template <>
	struct SlotHelper::is_usable<SlotHelper::unusable>
	{ enum { value = 0 }; };

	template<class A, class B>
	struct SlotHelper::select_switch<1, A, B>
	{
		typedef A value;
	};


	template<class A, class B>
	struct SlotHelper::select_switch<0, A, B>
	{
		typedef B value;
	};
}
#endif
